package com.palrevo.data.models;

import java.util.List;

import com.palrevo.data.services.ServiceBase.Tables;


/**
 * 
 * @author AAsha
 *
 */
@SuppressWarnings("serial")
public class Page implements Model {
	
	private Long id;
	private String title;
	private String body;
	private String icon;
	
	public Page(){
		
	}
	
	public Page(Page page){
		this.id = page.id;
		this.title = page.title;
		this.body = page.body;
		this.icon = page.icon;
	}
	
	public Page(Long id, String title, String body, String icon) {
		super();
		this.id = id;
		this.title = title;
		this.body = body;
		this.icon = icon;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public void setIcon(Object icon) {
		if(icon != null){
			this.icon = icon.toString();
		}		
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Page other = (Page) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	/**
	 * 
	 */
	@Override
	public String getTableName() {
		return Tables.pages.name();
	}
	
	/**
	 * 
	 */
	@Override
	public List<String> getFields() {
		//TODO AAsha >> add impl if needed;
		return null;
	}

}
